using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace DTLAutomateGUI
{
	public partial class MainScreen : Form
	{
		Design design = null;

		public MainScreen()
		{
			InitializeComponent();
			if (this.fileNameComboBox.Text != "") openXML(this.fileNameComboBox.Text);
			this.design = new Design(this);
		}

		public void openXML(string filename)
		{
			if (File.Exists(filename))
			{
				this.dataSetLayout.ReadXml(filename);
			}
		}

		private void buttonDesign_Click(object sender, EventArgs e)
		{
			if (this.design == null || this.design.IsDisposed) this.design = new Design(this);
			this.design.Show();
		}

		private void browseButton_Click(object sender, EventArgs e)
		{
			this.fileNameComboBox.Show();
		}

		private void openFileDialog_FileOk(object sender, CancelEventArgs e)
		{
			this.fileNameComboBox.Text = this.openFileDialog.FileName;
			Properties.Settings.Default.LastFileName = this.openFileDialog.FileName;
		}
	}
}